import request from '../utils/request'


export default{
    
    //登录
    login(data){
        return request.post(`/api/admin/user/login?`+data)
    },
    //注销登录
    logout(){
        return request.post(`/api/admin/user/logout`)
    },
    //获取验证码
    saveCaptcha(){
        return request.get(`/api/management-center/user/code`)
    },
    //获取头像
    handleImage(username){
        return request.post(`/api/management-center/user/getImage`,username)
    },
    //上传头像
    uploadImage(){
        return request.post(`/api/management-center/user/uploader`)
    },
    //获取所有用户,带分页查询
    queryAllUser(data){
        return request.post(`/api/management-center/user/page`,data)
    },
    //添加用户
    saveUser(data){
        return request.post(`/api/management-center/user/save`,data)
    },
    //根据id查询用户
    selectUserByUserId(userId){
        return request.post(`/api/management-center/user/selectUserId`,userId)
    },
    //根据id修改用户
    updateUserByUserId(data){
        return request.post(`/api/management-center/user/updateUserId`,data)
    },
    //修改密码
    updatePasswordByUserId(data){
        return request.post(`/api/management-center/user/updatePassword`,data)
    },
    //导出用户
    exportUser(data){
        return request.post(`/api/management-center/user/exportUser`,data)
    },
    //查询当前用户所拥有的角色
    queryUserRelationAllRole(data){
        return request.post(`/api/management-center/user/selectUserRelationAllRole`,data)
    },

    //给当前用户添加角色
    addUserRelationRole(data){
        return request.post(`/api/management-center/userrole/addUserRelationRole`,data)
    },
    //给当前用户删除角色
    deleteUserRelationRole(data){
        return request.post(`/api/management-center/userrole/deleteUserRelationRole`,data)
    },
    //查看当前用户关联菜单
    queryUserRelationAllMenu(data){
        return request.post(`/api/management-center/user/selectUserRelationAllMenu`,data)
    },    
    //查看当前用户关联菜单根据顶级父类生成树
    queryUserRelationAllMenuBy(data){
        return request.post(`/api/management-center/user/selectUserRelationAllMenuBy`,data)
    },    

    //根据客户名称返回客户信息
    queryUserByUsername(data){
        return request.post(`/api/management-center/user/queryUserByUsername`,data)
    },  
}

